#pragma once
#include "uiToolKit.h"

class CPropItemTrait;
class CPointProxy;
class CVarList;
class CPointProxy;

class GEOMUIAPI CPropHolder
{
	friend class CPropItemVisitor;
public:
	CPropHolder(void);
public:
	virtual ~CPropHolder(void);
	void Initialize(CPropList* pPropList);
	virtual bool SetValues(const CVarList& varValues);
	virtual bool GetValues(CVarList& varValues);
	bool IsValid();

	bool GetItemValue(UINT nID, _variant_t& value);
protected:
	bool SetItemValue(UINT nID, const _variant_t& value);
	bool SetItemValue(UINT nID, const CPointProxy& point);

	virtual bool AddItems() = 0;
	virtual int Low() = 0;
	virtual int Up() = 0;
protected:
	void AddGroup(const CString& szName,  UINT nID = 0);

	BOOL AddItem(const CString& name, const CString& value, UINT nID,  
		const CPropItemTrait& trait,
		const CString& description=_T(""));

	BOOL AddItem(const CString& name, const CPointProxy& value, UINT nID,  
		const CPropItemTrait& trait, const CString& description=_T(""));	

	BOOL AddItem(const CString& name, double value, UINT nID, 
		const CPropItemTrait& trait, const CString& description=_T(""));

	BOOL AddItem(const CString& name, bool value, UINT nID, 
		const CPropItemTrait& trait, const CString& description=_T(""));

	BOOL AddItem(const CString& name, int value, UINT nID, 
		const CPropItemTrait& trait, const CString& description=_T(""));

	void ResetGroup();

	void AddItem(CPropItem* pItem);


private:
	CPropList* m_pPropList;
	CPropItem* m_pCurGroup;
	bool m_bIsValid;
};

//////////////////////////////////////////////////////////////////////////

class GEOMUIAPI CPropItemTrait
{
public:
	CPropItemTrait(void);
	~CPropItemTrait();
	static const CPropItemTrait& Default(void);
public:
	BOOL bEnable;
	BOOL bAllowEdit;
};

//////////////////////////////////////////////////////////////////////////
